package com.wzdigit.wms.basic.enums;

import java.util.Objects;

/**
 * 基础模块-用户授权枚举类
 * @author yangdongjie
 * @BasicStatusEnum.java
 * @2021年2月2日下午2:33:44
 */
public enum UserDataPermissionEnum implements BaseEnum {

	WHS(0, "WHS", "attr"), 	// 仓库权限
	FAC(1, "FAC", "attr"), 	// 工厂权限
	OWN(2, "OWN", "attr"), 	// 货主权限
	CTC(3, "CTC", "attr"), 	// 成本中心
	WKC(4, "WKC", "attr");	// 工作中心
	
	/**
	 * 枚举值
	 */
	public int code;

	/**
	 * 枚举名称
	 */
	public String enumName;

	/**
	 * 枚举实体类属性描述
	 */
	public String description;

	UserDataPermissionEnum(String enumName, String description) {
		this.enumName = enumName;
		this.description = description;
	}

	UserDataPermissionEnum(int code, String enumName, String description) {
		this.code = code;
		this.enumName = enumName;
		this.description = description;
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}
	
	public String getEnumName() {
		return enumName;
	}

	public void setEnumName(String enumName) {
		this.enumName = enumName;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public static UserDataPermissionEnum getEnumByCode(int enumCode) {
		UserDataPermissionEnum[] values = UserDataPermissionEnum.values();
		UserDataPermissionEnum samplingEnum = null;

		for (UserDataPermissionEnum value : values) {
			if (value.getCode() == enumCode) {
				samplingEnum = value;
			}
		}
		return samplingEnum;
	}

	public static UserDataPermissionEnum getEnumByName(String enumName) {
		UserDataPermissionEnum[] values = UserDataPermissionEnum.values();
		UserDataPermissionEnum repairEnum = null;

		for (UserDataPermissionEnum value : values) {
			if (Objects.equals(value.getEnumName(), enumName)) {
				repairEnum = value;
			}
		}
		return repairEnum;
	}
}
